package Homework_03_31;

class Vehicle
{
    private String brand;
    private String color;
    private double speed;

    public Vehicle() {
    }

    public Vehicle(String brand, String color) {
        this.brand = brand;
        this.color = color;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public double getSpeed() {
        return speed;
    }

    public void setSpeed(double speed) {
        this.speed = speed;
    }

    public void run()
    {
        System.out.println("该汽车可以达到最高时速120km/h");
    }

}
class Car extends Vehicle
{
    private int loader;

    public Car() {
    }

    public Car(int loader) {
        this.loader = loader;
    }

    public Car(String brand, String color, int loader) {
        super(brand, color);
        this.loader = loader;
    }

    public int getLoader() {
        return loader;
    }

    public void setLoader(int loader) {
        this.loader = loader;
    }

    public void run()
    {
        System.out.println("该汽车最高时速可达100km/h");
    }
}


public class Main2 {
    public static void main(String[] args) {
        Vehicle car1 = new Vehicle("benz","black");
        Car car2 = new Car("Honda","red",2);
        System.out.println("该车的品牌为:" + car1.getBrand() + "  该车的颜色为:" + car1.getColor());
        car1.run();
        System.out.println("该车的品牌为:" + car2.getBrand() + "  该车的颜色为:" + car2.getColor() + "  该车最大荷载人数为:" + car2.getLoader());
        car2.run();
    }
}
